window.View = function()
{
    // 获取接口路径
    this.Paths = null;
    // 获取所有选中元素
    this.Elems = null;
    // 视图模板
    this.Tmps = null;
};

View.prototype = {

    /** 初始化视图*/
    init : function( o )
    {
        this.lib = o.lib || null ;
        // 获取接口路径
        this.Paths = o.paths;
        // 获取所有选中元素
        this.Elems = this.H.getElementsByIds( o.ids );
        // 获取所有视图模板
        this.Tmps = this.H.getTemplatesModle( o.templates );

        this.Paths["targetPath"] = this.Elems["typeTabs"].getAttribute("data-path" );

        this.bindEvent();
    },

    bindEvent : function()
    {
        var self = this;

        var opath = self.Paths["targetPath"];

        self.$( "a", self.Elems["typeTabs"] ).click( function()
        {
            if( this.parentNode.className == "active" ) return false;

            self.beforeSend();

            var f = top.window.FRAMES["detailsType"].element;

            var href = this.href.substring( this.href.indexOf("#") + 1 );

            f.onload = function()
            {
                self.afterSend();
            }

            f.src = opath.replace( /\[url\]/igm, href );

        }).eq( self.Elems["typeTabs"].getAttribute("data-default") || 0 ).click();
    },

    /** 请求前处理*/
    beforeSend : function()
    {
        var oloading = this.Elems["loading"];

        oloading.style.display = "block";
        oloading.style.opacity = 1;
        oloading.style["-webkit-transition"] =
            oloading.style["-moz-transition"] =
                oloading.style["-o-transition"] =
                    oloading.style["transition"] = "opacity 0.35s ease";
    },

    afterSend : function()
    {
        var oloading = this.Elems["loading"];

        oloading.style.opacity = 0;
        oloading.style.display = "none";
    }
};